<template>
  <a-modal :visible="myVisible" @ok="handleOk" @cancel="handleCancel">
    <template #title> 新建知识库 </template>
    <a-form :model="form" layout="vertical" ref="formRef">
      <a-form-item
        field="storeName"
        label="知识库名称"
        :rules="[{ required: true, message: '知识库名称不能为空' }]"
      >
        <a-input v-model="form.storeName" />
      </a-form-item>
      <a-form-item field="post" label="简介">
        <a-textarea v-model="form.remark" allow-clear />
      </a-form-item>
    </a-form>
  </a-modal>
</template>
<script setup lang="ts">
import { GetHumanRosterList } from '@/apis/management/human/humanRoster';
const props = withDefaults(
  defineProps<{
    visible: boolean;
    participantInfos?: any;
  }>(),
  {
    visible: false
  }
);
const myVisible = computed({
  get: () => props.visible,
  set: () => emit('update:visible')
});
const formRef = ref();
const form = reactive({
  storeName: '',
  remark: ''
});
const emit = defineEmits(['update:visible', 'addKnowledgeBase']);

const close = () => {
  formRef.value.resetFields();
  emit('update:visible', false);
};

const handleCancel = () => {
  close();
};
const handleOk = async () => {
  const res = await formRef.value.validate();
  if (res) return;
  emit('addKnowledgeBase', form);
  close();
};

//   watch(
//     () => props.visible,
//     (val) => {
//       val && getHumenList();
//     }
//   );
</script>
